package com.example.singletonpattern.entity;

import java.util.Objects;

/**
 * @author ash
 * @description
 * @create 2023/2/21  20:53:28
 * @className Singleton
 * @verson 1.0.0
 */
public class Singleton {
    private static Singleton instance;

    private Singleton() {
    }

    public static Singleton getInstance(){
        //如果该对象为空，创建一个对象
        if (Objects.isNull(instance)){
            instance = new Singleton();
        }
        return instance;
    }
}
